
class TreeNode(var `val`: Int) {
         var left: TreeNode? = null
         var right: TreeNode? = null
}

/**
 * 解法一 递归，判断左右相等
 */
class Solution {
    fun isSymmetric(root: TreeNode?): Boolean {
        if(root == null) {
            return true
        }
        
        return isSymmetric(root.left, root.right)
    }

    fun isSymmetric(left: TreeNode?,right :TreeNode?): Boolean {
        //递归终止条件
        if(left == null && right==null){
            return true
        }else if(left!=null && right!=null){
            if(left.`val` == right.`val`){
                return isSymmetric(left?.left, right?.right) && isSymmetric(left?.right, right?.left)
            }
        }
        return false 
    }
   
}

/**
 * 解法二 非递归，左右节点遍历判断
 */
class Solution {
    fun isSymmetric(root: TreeNode?): Boolean {
        
      
    }
   
}